package logo.lang;

public class LogoBool extends LogoVal {
    boolean value;

    protected LogoBool() {}	// no unspecified LogoBool's allowed

    public LogoBool(boolean v) {
	value = v;
    }
    
    public boolean isBool() { return true;}

    public boolean isTrue() {
	return value;
    }

    public boolean isFalse() {
	return !value;
    }

    public LogoBool eq(LogoVal v2) {
	if (v2.isBool())
	    if (value == v2.isTrue())
		return TRUE;
	return FALSE;
    }

    public LogoBool and(LogoBool v) {
	if (value && v.isTrue())
	    return TRUE;
	else
	    return FALSE;
    }

    public LogoBool or(LogoBool v) {
	if (value || v.isTrue())
	    return TRUE;
	else
	    return FALSE;
    }

    public LogoBool not() {
	if (isTrue())
	    return FALSE;
	else
	    return TRUE;
    }
    
}

